Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Expose window keyboard events to Tauri #12677

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

stijnfrishert
Copy link

@stijnfrishert stijnfrishert commented Feb 10, 2025

This PR implements #11671, which exposes keyboard input events for Tao in Tauri on the window-level.

To safeguard against breaking changes in Tao, I've opted to use types from keyboard-types as the public facing API in Tauri, and written converter functions in tauri-runtime-wry to move from one domain the the other.

Currently the PR exposes the following attributes:

  • Key state (pressed vs releases)
  • Logical key
  • Physical key
  • Location (Left/Right/etc.)
  • Is repeat?

Especially the logical and physical keys were a hassle, because both enums are alike, but there are subtle differences. I hope I've done the super -> meta conversion correct, and space needed special handling as well.

I have not done any testing, because I'm not sure how to do local Tauri testing.

Draft Questions

  • How should I handle converting non-exhaustive enums, such as ElementState and KeyLocation? Right now the converter function .expects(), but I'm not sure that's the most future -proof way of handling things?

Copy link
Contributor

github-actions bot commented Feb 18, 2025

Package Changes Through 443570d

There are 8 changes which include tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri with minor, @tauri-apps/api with minor, @tauri-apps/cli with minor, tauri-bundler with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.2.0 2.3.0
tauri-utils 2.1.1 2.2.0
tauri-bundler 2.2.3 2.2.4
tauri-runtime 2.3.0 2.4.0
tauri-runtime-wry 2.3.0 2.4.0
tauri-codegen 2.0.4 2.0.5
tauri-macros 2.0.4 2.0.5
tauri-plugin 2.0.4 2.0.5
tauri-build 2.0.5 2.0.6
tauri 2.2.5 2.3.0
@tauri-apps/cli 2.2.7 2.3.0
tauri-cli 2.2.7 2.3.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@stijnfrishert stijnfrishert marked this pull request as ready for review February 20, 2025 09:19
@stijnfrishert stijnfrishert requested a review from a team as a code owner February 20, 2025 09:19
@stijnfrishert stijnfrishert marked this pull request as draft February 20, 2025 10:39
@stijnfrishert stijnfrishert force-pushed the 11671-expose-window-keyboard-input branch from 3f61064 to 443570d Compare February 20, 2025 10:47
@amrbashir
Copy link
Member

  • How should I handle converting non-exhaustive enums, such as ElementState and KeyLocation? Right now the converter function .expects(), but I'm not sure that's the most future -proof way of handling things?

instead of returning None in these conversion functions, just remove the Option and add unimplemented!() macro call with a helpful message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants